<?php
	class Config {
		/**
		 * Construct a new configuration object
		 * @name Config
		 * @package Core		 
		 * @copyright AZPHPGuru.com		 
		 */
		function __construct($configFile='core', $autoload=true) {
			$this->config = array('loaded' => false, 'strdata' => new TextFile(dirname(__FILE__).'/../config/'.$configFile.'.conf'));
			if($autoload == true) {
				$this->load();
			}
		}
		function load() {
			if(stristr($this->config['strdata']->data, "\n")){
				$this->config['rawdata'] = explode("\n", $this->config['strdata']->data);
			} else {
				$this->config['rawdata'] = array($this->config['strdata']->data);
			}
			foreach($this->config['rawdata'] as $data) {
				$linedata = explode('=', $data);
				$var = isset($linedata[0]) ? trim($linedata[0]) : '';
				$val = isset($linedata[1]) ? trim($linedata[1]) : '';
				if(strlen($var) > 0) {
					$this->data[$var] = $val;
				}
			}
		}
	}
?>